import request from "@/utils/request";

// 获取banner列表
export function getBanner() {
  return request({
    url: "/project/banner"
  });
}

// 根据栏目获取项目列表
export function getList(type, params) {
  return request({
    url: `/project/list/${type}`,
    params
  });
}
// 获取精选列表
export function getBoutique(params) {
  return request({
    url: `/project/boutique`,
    params
  });
}

// 获取最新最热的project列表
export function getNewHot(type, params) {
  return request({
    url: `/project/${type}`,
    params
  });
}

// 添加收藏
export function addCollect(id) {
  return request({
    url: `/collect/addCollect/${id}`,
    method: "post"
  });
}
// 是否收藏
export function isCollect(id) {
  return request({
    url: `/collect/isCollect/${id}`
  });
}

// 取消收藏
export function cancelCollect(id) {
  return request({
    url: `/collect/delete/${id}`,
    method: "delete"
  });
}

// 获取项目详情
export function getInfo(id) {
  return request({
    url: `/project/info/${id}`
  });
}
// 获取项目详情的目录
export function getUnit(id, params) {
  return request({
    url: `/unit/list/${id}`,
    params
  });
}
// 获取项目详情的评论
export function getComment(id, params) {
  return request({
    url: `/comment/list/project/${id}`,
    params
  });
}

export function addComment(params) {
  return request({
    url: `/comment/comment`,
    method: "POST",
    params
  });
}

// 评论点赞
export function onPraise(id) {
  return request({
    url: `/praise/save/${id}`,
    method: "POST"
  });
}

// 微信支付下单
export function wechatPay(id, data) {
  return request({
    url: `/wechat/pay/pre/order/${id}`,
    method: "POST",
    data
  });
}
// 微信支付下单
export function wechatPay2(id, params) {
  return request({
    url: `/wechat/pay/pre/semester/${id}`,
    method: "POST",
    params
  });
}

export function getCpnpop(id) {
  return request({
    url: `/coupon/all/got/${id}`
  });
}

export function getBrokerage(id) {
  return request({
    url: `/project/commission/info/${id}`
  });
}

// 第二个公众号的二维码接口
export function getConsultant() {
  return request({
    url: `/wechat/setting/consultant/love`
  });
}
